Skip to content

Fall back to the request Host for the join-token panel_addr#13

Merged
iamfarhad merged 1 commit into
mainfrom
feat/ui-redesign-production-docker
Jul 18, 2026
Merged

Fall back to the request Host for the join-token panel_addr#13
iamfarhad merged 1 commit into
mainfrom
feat/ui-redesign-production-docker

Conversation

@iamfarhad

Copy link
Copy Markdown
Owner

IP-only deployments (no PANEL_DOMAIN configured) got panel_addr: null, so the join-token dialog showed no control-plane address exactly where the guidance matters most. The Host the admin is browsing the panel on reaches this server by definition - use it (port stripped) when neither the live panel-domain setting nor the boot-time PANEL_DOMAIN is set.

IP-only deployments (no PANEL_DOMAIN configured) got panel_addr: null,
so the join-token dialog showed no control-plane address exactly where
the guidance matters most. The Host the admin is browsing the panel on
reaches this server by definition - use it (port stripped) when neither
the live panel-domain setting nor the boot-time PANEL_DOMAIN is set.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@iamfarhad
iamfarhad merged commit 744d170 into main Jul 18, 2026
2 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the control plane address resolution to fall back to the request's Host header when no panel domain is configured, facilitating IP-only deployments. The API documentation has been updated accordingly. Feedback is provided regarding a potential issue with IPv6 addresses without a port, which could result in double-bracket wrapping when calling net.JoinHostPort; a code suggestion is included to strip the brackets if they are present.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +229 to +235
if host == "" {
if h, _, err := net.SplitHostPort(r.Host); err == nil {
host = h
} else {
host = r.Host
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If the admin accesses the panel using an IPv6 address without a port (e.g., [::1]), net.SplitHostPort will fail and host will be set to [::1]. When net.JoinHostPort is subsequently called, it will detect the colon in [::1] and wrap it in brackets again, resulting in an invalid address like [[::1]]:port.

To prevent this double-wrapping, strip the brackets from host if they are present before calling net.JoinHostPort.

Suggested change
if host == "" {
if h, _, err := net.SplitHostPort(r.Host); err == nil {
host = h
} else {
host = r.Host
}
}
if host == "" {
if h, _, err := net.SplitHostPort(r.Host); err == nil {
host = h
} else {
host = r.Host
}
if len(host) > 2 && host[0] == '[' && host[len(host)-1] == ']' {
host = host[1 : len(host)-1]
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant